#ifndef _VIDEO_H_
#define _VIDEO_H_

#include <dpmi.h>
#include <stdio.h>
#include <conio.h>
#include <dpmi.h>
#include <go32.h>
#include <sys/farptr.h>
#include <pc.h>
#include <stdlib.h>
#include <sys/nearptr.h>
#include <math.h> 
#include "utypes.h"


#define VIDEO_IRQ 0x10	/**< video graphics interrupt */

/**< Possible graphical modes */
#define MODE_1 1	/* MODE_1: 640x480 */
#define MODE_3 3	/* MODE_3: 800x600 */
#define MODE_5 5 	/* MODE_5: 1024x768 */
#define MODE_7 7	/* MODE_7: 1280x1024 */
						


/** @defgroup Video Video 
 * @{
 *
 * Entering/leaving/utility video functions
 */

/*
 * there are two global variables, declared (but not defined) here
 */
extern int HRES;  /**< global variable with the horizontal resolution in pixels */
extern int VRES;  /**< global variable with the vertical resolution in pixels */



/** Enter graphics mode, enabling near pointers and mapping video physical memory
 * to program virtual address.
 *
 * Returns a generic pointer pointing to video memory address or NULL on error. 
 * "mode" specifies the VESA graphics mode to use, and
 * the mapping information is returned through "map".
 *
 * Also initializes two global variables, VRES and HRES,
 */
char * enter_graphics(int mode, __dpmi_meminfo *map);



/** Unmap video memory, disable near pointer and returns to text mode
 */
void leave_graphics(__dpmi_meminfo map);



/** Draws a pixel of color "color" at screen coordinates x, y at memory address "base"
 */
void set_pixel(int x, int y, int color, char *base);



/** Returns the pixel color at screen coordinates x, y at memory address "base"
 */
int get_pixel(int x, int y, char *base);



/** Set graphics memory at memory address "base" to "color".
 */
void clear_screen(char color, char *base);



/** Returns the video memory address according to the VESA result
*/
ulong get_VBE_address(int mode);




/** @} end of video */ 

#endif
